/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package uimigration.Interactions.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import uimigration.Interactions.InteractionsPackage;
import uimigration.Interactions.MoveWidget;
import uimigration.Interactions.Rotate;
import uimigration.Interactions.Translate;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Move Widget</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link uimigration.Interactions.impl.MoveWidgetImpl#getDescription <em>Description</em>}</li>
 *   <li>{@link uimigration.Interactions.impl.MoveWidgetImpl#getIsTranslation <em>Is Translation</em>}</li>
 *   <li>{@link uimigration.Interactions.impl.MoveWidgetImpl#getIsRotation <em>Is Rotation</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MoveWidgetImpl extends BehaviourImpl implements MoveWidget {
	/**
	 * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDescription()
	 * @generated
	 * @ordered
	 */
	protected static final String DESCRIPTION_EDEFAULT = null;
	/**
	 * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDescription()
	 * @generated
	 * @ordered
	 */
	protected String description = DESCRIPTION_EDEFAULT;
	/**
	 * The cached value of the '{@link #getIsTranslation() <em>Is Translation</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIsTranslation()
	 * @generated
	 * @ordered
	 */
	protected Translate isTranslation;
	/**
	 * The cached value of the '{@link #getIsRotation() <em>Is Rotation</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIsRotation()
	 * @generated
	 * @ordered
	 */
	protected Rotate isRotation;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MoveWidgetImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return InteractionsPackage.Literals.MOVE_WIDGET;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDescription(String newDescription) {
		String oldDescription = description;
		description = newDescription;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InteractionsPackage.MOVE_WIDGET__DESCRIPTION, oldDescription, description));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Translate getIsTranslation() {
		return isTranslation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetIsTranslation(Translate newIsTranslation,
			NotificationChain msgs) {
		Translate oldIsTranslation = isTranslation;
		isTranslation = newIsTranslation;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InteractionsPackage.MOVE_WIDGET__IS_TRANSLATION, oldIsTranslation, newIsTranslation);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIsTranslation(Translate newIsTranslation) {
		if (newIsTranslation != isTranslation) {
			NotificationChain msgs = null;
			if (isTranslation != null)
				msgs = ((InternalEObject)isTranslation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - InteractionsPackage.MOVE_WIDGET__IS_TRANSLATION, null, msgs);
			if (newIsTranslation != null)
				msgs = ((InternalEObject)newIsTranslation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - InteractionsPackage.MOVE_WIDGET__IS_TRANSLATION, null, msgs);
			msgs = basicSetIsTranslation(newIsTranslation, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InteractionsPackage.MOVE_WIDGET__IS_TRANSLATION, newIsTranslation, newIsTranslation));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Rotate getIsRotation() {
		return isRotation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetIsRotation(Rotate newIsRotation,
			NotificationChain msgs) {
		Rotate oldIsRotation = isRotation;
		isRotation = newIsRotation;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InteractionsPackage.MOVE_WIDGET__IS_ROTATION, oldIsRotation, newIsRotation);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIsRotation(Rotate newIsRotation) {
		if (newIsRotation != isRotation) {
			NotificationChain msgs = null;
			if (isRotation != null)
				msgs = ((InternalEObject)isRotation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - InteractionsPackage.MOVE_WIDGET__IS_ROTATION, null, msgs);
			if (newIsRotation != null)
				msgs = ((InternalEObject)newIsRotation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - InteractionsPackage.MOVE_WIDGET__IS_ROTATION, null, msgs);
			msgs = basicSetIsRotation(newIsRotation, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InteractionsPackage.MOVE_WIDGET__IS_ROTATION, newIsRotation, newIsRotation));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd,
			int featureID, NotificationChain msgs) {
		switch (featureID) {
			case InteractionsPackage.MOVE_WIDGET__IS_TRANSLATION:
				return basicSetIsTranslation(null, msgs);
			case InteractionsPackage.MOVE_WIDGET__IS_ROTATION:
				return basicSetIsRotation(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case InteractionsPackage.MOVE_WIDGET__DESCRIPTION:
				return getDescription();
			case InteractionsPackage.MOVE_WIDGET__IS_TRANSLATION:
				return getIsTranslation();
			case InteractionsPackage.MOVE_WIDGET__IS_ROTATION:
				return getIsRotation();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case InteractionsPackage.MOVE_WIDGET__DESCRIPTION:
				setDescription((String)newValue);
				return;
			case InteractionsPackage.MOVE_WIDGET__IS_TRANSLATION:
				setIsTranslation((Translate)newValue);
				return;
			case InteractionsPackage.MOVE_WIDGET__IS_ROTATION:
				setIsRotation((Rotate)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case InteractionsPackage.MOVE_WIDGET__DESCRIPTION:
				setDescription(DESCRIPTION_EDEFAULT);
				return;
			case InteractionsPackage.MOVE_WIDGET__IS_TRANSLATION:
				setIsTranslation((Translate)null);
				return;
			case InteractionsPackage.MOVE_WIDGET__IS_ROTATION:
				setIsRotation((Rotate)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case InteractionsPackage.MOVE_WIDGET__DESCRIPTION:
				return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
			case InteractionsPackage.MOVE_WIDGET__IS_TRANSLATION:
				return isTranslation != null;
			case InteractionsPackage.MOVE_WIDGET__IS_ROTATION:
				return isRotation != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (description: ");
		result.append(description);
		result.append(')');
		return result.toString();
	}

} //MoveWidgetImpl
